<template>
	<view style="padding-bottom: 120rpx;">
		<u-navbar
			v-if="!$isWeixin()"
			:customBack="backToList"
			:title="title"
			title-width="450"
			:titleBold="true"
			:background="{ backgroundColor: '#ffffff' }"
			:is-fixed="true"
		></u-navbar>

		<u-tabs active-color="#FF7A23" :list="tabList" :current="tabIndex" @change="index => (tabIndex = index)"></u-tabs>

		<view class="" v-if="tabIndex === 0"><relations :list="state.This_Dealer_RelationList"></relations></view>

		<view class="" v-if="tabIndex === 1">
			<u-cell-item :arrow="false" title="一级经销商名称" :value="state.First_Dealer_BaseInfo.Name"></u-cell-item>
			<u-cell-item :arrow="false" title="二级经销商名称" :value="state.Double_Dealer_BaseInfo.Name"></u-cell-item>
			<u-cell-item :arrow="false" title="门店名称" :value="state.Door_Dealer_BaseInfo.Name"></u-cell-item>
			<u-cell-item :arrow="false" title="门店代码" :value="state.Door_Dealer_BaseInfo.Account"></u-cell-item>
		</view>

		<view class="" v-if="tabIndex === 2"><door-money-information :data="state.DoorApplyInfo"></door-money-information></view>

		<view class="btn-group-fixed"><u-button @tap="backToList">返回列表</u-button></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			title: '动力金审核详情',
			tabList: [{ name: '销售业务关系' }, { name: '基本信息' }, { name: '门头信息' }],
			tabIndex: 0,

			DoorId: 4640,

			state: {
				ShowLevel: null,
				First_Dealer_BaseInfo: {},
				Double_Dealer_BaseInfo: {},
				Door_Dealer_BaseInfo: {},
				This_Dealer_OtherInfo: {},
				This_Dealer_RelationList: [],
				DoorApplyInfo: {},
				RealList: []
			}
		};
	},

	onLoad(options) {
		if (options.DoorId) {
			this.DoorId = options.DoorId;
		}
		this.init();

		if (this.$isWeixin()) {
			this.$setTitle(this.title);
		}
	},

	methods: {
		backToList() {
			uni.navigateBack();
		},

		init() {
			this.$u.api
				.getStoreRenovationReviewDetail({
					StoreRenovationId: this.DoorId,
					ApplyType: 1
				})
				.then(res => {
					console.log(res);
					const { ResultCode, ResultMessage, ResultData } = res;
					if (ResultCode === 1) {
						this.state = ResultData;
					}
				});
		}
	}
};
</script>

<style lang="scss"></style>
